<?php
namespace API\Controller;
use Think\Controller;
class OthersserviceController extends Controller {
   public function getAllActivity(){
      $activityModel=M('activity');
      $activity=$activityModel->order('activity_id desc')->select();
      echo json_encode($activity);
   }
   public function getAllActivitybyId(){
   	  $activity_id=$_GET['activity_id'];
   	  $activityModel=M('activity');
   	  $info=$activityModel->where("activity_id='$activity_id'")->select();
   	  echo json_encode($info);
   }
   public function applyactivity(){
   	  $activity_id=$_GET['activity_id'];
   	  $activity_apply_name=$_GET['activity_apply_name'];
   	  $activity_apply_tel=$_GET['activity_apply_tel'];
   	  $activity_apply_samount=$_GET['activity_apply_samount'];
   	  $activity_apply_aamount=$_GET['activity_apply_aamount'];
   	  $activity_apply_name1=$_GET['activity_apply_name1'];
   	  $activity_apply_tel1=$_GET['activity_apply_tel1'];
   	  $activity_apply_name2=$_GET['activity_apply_name2'];
   	  $activity_apply_tel2=$_GET['activity_apply_tel2'];
   	  $activity_apply_all=$_GET['activity_apply_payways'];
      $activity_applyModel=M('activity_apply');
      $data=$activity_applyModel->create();
      $data['activity_id']=$activity_id;
      $data['activity_apply_name']=$activity_apply_name;
      $data['activity_apply_tel']=$activity_apply_tel;
      $data['activity_apply_samount']=$activity_apply_samount;
      $data['activity_apply_aamount']=$activity_apply_aamount;
      $data['activity_apply_name1']=$activity_apply_name1;
      $data['activity_apply_tel1']=$activity_apply_tel1;
      $data['activity_apply_name2']=$activity_apply_name2;
      $data['activity_apply_tel2']=$activity_apply_tel2;
      $data['activity_apply_all']=$activity_apply_all;
      $res=$activity_applyModel->data($data)->add();
      if($res){
      	$success='1';
      }else{
      	$success='0';
      }
      $json=array('success'=>$success);
      echo json_encode($json);
   }
   public function getAllActivityevent(){
   	  $event=M('activity_event');
   	  $activity_event=$event->order('activity_event_id desc')->select();
   	  echo json_encode($activity_event);
   }
   public function getAllActivityeventbyId(){
   	  $activity_event_id=$_GET('activity_event_id');
   	  $activity_event=M('activity_event');
   	  $info=$activity_event->where("activity_event_id='$activity_event_id'")->select();
   	  echo json_eccode($info);
   }
}